﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace weba
{
    public partial class denglu : System.Web.UI.Page
    {
        sjklqDataContext sj = new sjklqDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnLogin_Click(object sender, EventArgs e)
        {
            try

            {
             var lg =   sj.CheckUserLogin(this.yhm.Text.Trim(), this.mm.Text.Trim()).ToList();
             Session["User_ID"] = this.yhm.Text.Trim().ToString();
             dl.CreatCookies("Power_Name",4, lg.FirstOrDefault().T_PowerName.ToString(), "");
             dl.CreatCookies("User_ID", 4, lg.FirstOrDefault().T_ServiceID.ToString(), "");
                 dl.CreatCookies("Power_Mes", 4, lg.FirstOrDefault().T_PowerMes.ToString(), "");
                 dl.CreatCookies("User_Name", 4, this.yhm.Text.Trim().ToString(), "");
                // dl.CreatCookies("", 4, lg.FirstOrDefault()..ToString(), "");
               //  mk.Alert(Session["User_ID"].ToString());
                 Response.Redirect("Default.aspx",false);
            }
            catch (System.Exception ex)
            {
            	Response.Redirect(Request.RawUrl);
                Response.Write(ex.Message.ToString());
            }
           
        }
    }
}